import React, { useState } from 'react'
import Scroll from './components/scroll';
import Ellipsis from './components/ellipsis';

function App() {

  const [type, setType] = useState('ellipsis')

  const renderDom = (type) => {
    if (type === 'scroll') {
      return <Scroll />
    } else if (type === 'ellipsis') {
      return <Ellipsis />
    }
  }

  return <div>
    <div onClick={() => setType('ellipsis')}>ellipsis</div>
    <div onClick={() => setType('scroll')}>scroll</div>
    {renderDom(type)}
  </div>
}

export default App
